{include file="header.htm" /}
<script src="__WEAPP_TEMPLATE__/skin/js/jscolor.min.js?v={$weappInfo.version|default='v1.0.0'}"></script>
<style>.row .tit{width: 130px!important;}.sort-list-img .images_upload_box{border-bottom: 1px solid #eee!important;}</style>
<body class="bodystyle" style="overflow-y: scroll; cursor: default; -moz-user-select: inherit;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    {include file="bar.htm" /}
    <form class="form-horizontal" id="post_form" action="{:weapp_url('MonkWeixin/MonkWeixin/index')}" method="post">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>调用方式</label>
                </dt>
                <dd class="opt">
                    <div class="onoff">
                        <label for="tag_weapp1" class="cb-enable {if condition='!isset($info.tag_weapp) || $info.tag_weapp eq 1'}selected{/if}">系统自动</label>
                        <label for="tag_weapp0" class="cb-disable {if condition='isset($info.tag_weapp) && $info.tag_weapp eq 2'}selected{/if}">手工调用</label>
                        <input id="tag_weapp1" name="tag_weapp" value="1" type="radio" {if condition="!isset($info.tag_weapp) || $info.tag_weapp eq 1"} checked="checked"{/if}>
                        <input id="tag_weapp0" name="tag_weapp" value="2" type="radio" {if condition="isset($info.tag_weapp) && $info.tag_weapp eq 2"} checked="checked"{/if}>
                    </div>                    
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>功能</label>
                </dt>
                <dd class="opt">
                    <div class="onoff">
                        <label for="is_open1" class="cb-enable {if condition='!isset($row.is_open) || $row.is_open eq 1'}selected{/if}">开启</label>
                        <label for="is_open0" class="cb-disable {if condition='isset($row.is_open) && $row.is_open eq 2'}selected{/if}">关闭</label>
                        <input id="is_open1" name="is_open" value="1" type="radio" {if condition="!isset($row.is_open) || $row.is_open eq 1"} checked="checked"{/if}>
                        <input id="is_open0" name="is_open" value="2" type="radio" {if condition="isset($row.is_open) && $row.is_open eq 2"} checked="checked"{/if}>
                    </div>                    
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit"><label>微信号/二维码</label> </dt>
                <dd class="opt">
                    <div class="tab-pane pics" id="tab_proimg">
                        <table class="table table-bordered">
                            <tbody>
                                <tr>
                                    <td>
                                        <div class="sort-list-img ui-sortable"> 
                                            {volist name='row.proimg' id="v"}
                                            {php}$key=$key+1;{/php}
                                            <div class="images_upload images_upload_html" data-id="{$key}">
                                                <div class="images_upload_box">
                                                    <input type="hidden" name="proimg[{$key}][]" value="{$v.code_img}">
                                                    <a href="{$v}" onclick="" class="upimg" title="拖动修改排序" target="_blank">
                                                        <img src="{$v.code_img}">
                                                    </a>
                                                    <a href="javascript:void(0)" class="delect" title="删除" onclick="ClearPicArr2(this,'{$v.code_img}')"></a>
                                                </div>     
                                                <input type="text" name="proimg[{$key}][]" value="{$v.wechat_name}" placeholder="微信号" style="width: 86px;"></input>                       
                                            </div>
                                            {/volist}
                                        <div class="images_upload ui-sortable-handle" style=""></div> </div>
                                        <a href="javascript:void(0);" onclick="GetUploadify(30,'','allimg','proimg_call_back');" class="img-upload mb15" title="点击上传"> <div class="y-line"></div> <div class="x-line"></div> </a>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <!-- 上传图片显示的样板 start -->
                    <div class="images_upload_tpl none">
                        <div class="images_upload images_upload_html">
                            <div class="images_upload_box">
                                <input type="hidden" name="proimg[]" value="">
                                <a href="javascript:void(0);" onclick="" class="upimg" title="拖动修改排序">
                                    <img src="/public/static/admin/images/add-button.jpg">
                                </a>
                                <a href="javascript:void(0)" class="delect" title="删除">&nbsp;&nbsp;</a>                                
                            </div>                            
                            <input type="text" name="proimg[]" placeholder="微信号" style="width: 86px;"></input>
                        </div>
                    </div>
                    <!-- 上传图片显示的样板 end -->
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="ad_intro">提示文案</label>
                </dt>
                <dd class="opt">
                    <textarea rows="5" cols="80" id="ad_intro" name="ad_intro" style="height:80px;" placeholder="提示文案">{$row.ad_intro}</textarea>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="sort_order">顶部展示设置</label>
                </dt>
                <dd class="opt">
                    <label><input type="radio" name="is_top" value="0" {if !isset($row.is_top) || empty($row.is_top)}checked{/if}>全部</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_top" value="1" {if isset($row.is_top) && $row.is_top==1}checked{/if}>手机端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_top" value="2" {if isset($row.is_top) && $row.is_top==2}checked{/if}>电脑端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_top" value="3" {if isset($row.is_top) && $row.is_top==3}checked{/if}>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class="err"></span>
                    <p class="notic2">吸顶工具条</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="sort_order">右下角展示设置</label>
                </dt>
                <dd class="opt">
                    <label><input type="radio" name="is_right" value="0" {if !isset($row.is_right) || empty($row.is_right)}checked{/if}>全部</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_right" value="1" {if isset($row.is_right) && $row.is_right==1}checked{/if}>手机端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_right" value="2" {if isset($row.is_right) && $row.is_right==2}checked{/if}>电脑端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_right" value="3" {if isset($row.is_right) && $row.is_right==3}checked{/if}>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;<label class="pr5">距底部:</label><input type="text" name="is_right_width" placeholder="" value="{$row.is_right_width|default='100'}" id="is_right_width" class="input-txt" style="width: 60px !important;" oninput="value=value.replace(/^[^\d]+/g,'')">&nbsp;像素
                    <span class="err"></span>
                    <p class="notic2">动态绿色微信图标</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="sort_order">底部展示设置</label>
                </dt>
                <dd class="opt">
                    <label><input type="radio" name="is_down" value="0" {if !isset($row.is_down) || empty($row.is_down)}checked{/if}>全部</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_down" value="1" {if isset($row.is_down) && $row.is_down==1}checked{/if}>手机端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_down" value="2" {if isset($row.is_down) && $row.is_down==2}checked{/if}>电脑端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_down" value="3" {if isset($row.is_down) && $row.is_down==3}checked{/if}>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class="err"></span>
                    <p class="noti2c">固底工具条</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="sort_order">插入文章展示设置</label>
                </dt>
                <dd class="opt">
                    <label><input type="radio" name="is_news" value="0" {if !isset($row.is_news) || empty($row.is_news)}checked{/if}>全部</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_news" value="1" {if isset($row.is_news) && $row.is_news==1}checked{/if}>手机端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_news" value="2" {if isset($row.is_news) && $row.is_news==2}checked{/if}>电脑端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_news" value="3" {if isset($row.is_news) && $row.is_news==3}checked{/if}>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="sort_order">自定义文章内容</label>
                </dt>
                <dd class="opt">
                    <label><input type="radio" name="is_news_type" value="0" {if !isset($row.is_news_type) || empty($row.is_news_type)}checked{/if}>排查栏目</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_news_type" value="1" {if isset($row.is_news_type) && $row.is_news_type==1}checked{/if}>指定文章ID</label>&nbsp;&nbsp;&nbsp;&nbsp;
                </dd>
            </dl>
            <dl class="row" id="is_news_1" {if isset($row.is_news_type) && $row.is_news_type==1}style="display:block"{else/}style="display:none"{/if}>
                <dt class="tit">
                    <label for="access_key">指定文章id</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="ids" placeholder="文章id" value="{$row.ids}" id="ids" class="input-txt">
                    <p class="">指定文章id展示，多条文章用,号隔开</p>                
                </dd>
            </dl>
            <dl class="row" id="is_news_2" {if !isset($row.is_news_type) || empty($row.is_news_type)}style="display:block"{else/}style="display:none"{/if}>
                <dt class="tit">
                    <label for="title" id="is_typeids">排除栏目</label>
                </dt>
                <dd class="opt">
                    <select name="is_typeids[]" id="is_typeids" style="width: 300px;" size="15" multiple="true">                        
                        {$select_html}
                    </select>
                    <span class="err"></span>
                    <p class="red">(按 Ctrl 可以进行多选)</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="btn_color">复制微信号按钮</label>
                </dt>
                <dd class="opt">                    
                    <input type="text" name="btn_color" value="{$row.btn_color|default='#1aad19'}" id="btn_color" class="input-txt"  data-jscolor="{}">
                </dd>
            </dl>
            <dl class="row" id='is_news-itm' {if isset($row.is_news) && $row.is_news==3} style="display: none"{else/} style="display: block"{/if}>
                <dt class="tit">
                    <label for="sort_order">插入文章位置</label>
                </dt>
                <dd class="opt">
                    <label><input type="radio" name="is_news_wz" value="0" {if !isset($row.is_news_wz) || empty($row.is_news_wz)}checked{/if}>文章开头</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_news_wz" value="1" {if isset($row.is_news_wz) && $row.is_news_wz==1}checked{/if}>第一段落之后</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_news_wz" value="2" {if isset($row.is_news_wz) && $row.is_news_wz==2}checked{/if}>文章中间</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_news_wz" value="3" {if isset($row.is_news_wz) && $row.is_news_wz==3}checked{/if}>文章尾部</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label class="pr5">插入第:</label><input type="text" name="is_duan" placeholder="" value="{$row.is_duan|default='0'}" id="is_duan" class="input-txt" style="width: 60px !important;" oninput="value=value.replace(/^[^\d]+/g,'')">&nbsp;段后<span class="red">（自定义段落大于0，将优先其他选项）</span>
                    <span class="err"></span>                    
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="sort_order">电话展示设置</label>
                </dt>
                <dd class="opt">
                    <label><input type="radio" name="is_tel" value="0" {if !isset($row.is_tel) || empty($row.is_tel)}checked{/if}>全部</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_tel" value="1" {if isset($row.is_tel) && $row.is_tel==1}checked{/if}>手机端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_tel" value="2" {if isset($row.is_tel) && $row.is_tel==2}checked{/if}>电脑端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_tel" value="3" {if isset($row.is_tel) && $row.is_tel==3}checked{/if}>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label class="pr5">电话号码:</label><input type="text" name="tel" placeholder="电话号码" value="{$row.tel|default=''}" id="tel" class="input-txt" style="width: 160px !important;" oninput="value=value.replace(/^[^\d]+/g,'')">&nbsp;手机端支持点击拨号                    
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="sort_order">强制弹窗设置</label>
                </dt>
                <dd class="opt">
                    <label><input type="radio" name="is_wind" value="0" {if !isset($row.is_wind) || empty($row.is_wind)}checked{/if}>全部</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_wind" value="1" {if isset($row.is_wind) && $row.is_wind==1}checked{/if}>手机端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_wind" value="2" {if isset($row.is_wind) && $row.is_wind==2}checked{/if}>电脑端</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="is_wind" value="3" {if isset($row.is_wind) && $row.is_wind==3}checked{/if}>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
                    <label class="pr5"></label><input type="text" name="is_times" placeholder="秒" value="{$row.is_times|default='3600'}" id="is_times" class="input-txt" style="width: 60px!important;" oninput="value=value.replace(/^[^\d]+/g,'')">&nbsp;秒弹一次，关闭后 <input type="text" name="is_times_after" placeholder="秒" value="{$row.is_times_after|default='1'}" id="is_times_after" class="input-txt" style="width: 60px !important;" oninput="value=value.replace(/^[^\d]+/g,'')">&nbsp;天不弹
                    <p class="notic2">仅在点击一键复制时触发记忆</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="sort_order">主要文字设置</label>
                </dt>
                <dd class="opt">
                     <input type="text" name="is_val" placeholder="添加微信" value="{$row.is_val|default='添加微信'}" id="is_val" class="input-txt" style="width: 160px!important;">&nbsp;<input type="text" name="is_value" placeholder="微信号" value="{$row.is_value|default='微信号'}" id="is_value" class="input-txt" style="width: 160px!important;">&nbsp;分别对应添加微信、微信号，留空时展示默认值
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>蜘蛛屏蔽设置</label>
                </dt>
                <dd class="opt">
                    <div class="onoff">                        
                        <label for="is_zhizu0" class="cb-enable {if !isset($row.is_zhizu) || empty($row.is_zhizu)}selected{/if}">是</label>
                        <label for="is_zhizu1" class="cb-disable {if isset($row.is_zhizu) && $row.is_zhizu==1}selected{/if}">否</label>
                        <input id="is_zhizu0" name="is_zhizu" value="0" type="radio" {if !isset($row.is_zhizu) || empty($row.is_zhizu)}checked="checked"{/if}>   
                        <input id="is_zhizu1" name="is_zhizu" value="1" type="radio" {if isset($row.is_zhizu) && $row.is_zhizu==1}checked="checked"{/if}>
                    </div>                    
                    <p class="">&nbsp;&nbsp;开启时以上所有前端输出代码将对主流搜索引擎不可见，生成静态页时不起作用</p>
                </dd>
            </dl>
            <div class="bot m30">
                <input type="hidden" name="code" value="{$row.code}" />
                <a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    const colorPicker = document.getElementById('btn_color');
    colorPicker.addEventListener('input', function() {
        console.log(colorPicker.value); // 输出选择的颜色的HEX值        
    });
    $(document).ready(function() {
        // 监听所有 name 为 'radioGroup' 的 radio 按钮的 change 事件
        $("input[name='is_news']").change(function() {
            // 获取当前选中的 radio 按钮的值
            var selectedValue = $(this).val();
            // 在控制台打印出选中的值
            if(selectedValue==3){
                $('#is_news-itm').css('display','none');
            }else{
                $('#is_news-itm').css('display','block');
            }
        });
        $("input[name='is_news_type']").change(function() {            
            var selectedValue = $(this).val();
            if(selectedValue==1){
                $('#is_news_1').css('display','block');
                $('#is_news_2').css('display','none');
            }else{
                $('#is_news_2').css('display','block');
                $('#is_news_1').css('display','none');
            }
        });
    });
    // 判断输入框是否为空
    function checkForm(){
        var is_news_type = $("input[name='is_news_type']:checked").val();
        if(is_news_type==1){
            if($('input[name=ids]').val() == ''){
                showErrorMsg('指定文章id不能为空');
                $('input[name=ids]').focus();
                return false;
            }
        }
        layer_loading('正在处理');
        $('#post_form').submit();
    }
    // 上传产品相册回调函数
    function proimg_call_back(paths){  
        var $elements = $('.images_upload_html');
        var maxId = 0; // 初始化最大ID为0
        // 遍历这些元素
        $elements.each(function() {
            // 获取当前元素的 data-id 属性
            var currentId = parseInt($(this).data('id'), 10); // 使用 parseInt 确保数字正确解析
            // 检查并更新最大ID
            if (currentId > maxId) {
                maxId = currentId;
            }
        });
        maxId =maxId+1;   
        console.log("最大"+maxId);  
        var  last_div = $(".images_upload_tpl").html();
        for (var i=0;i<paths.length ;i++ )
        {
            if ($(".sort-list-img .images_upload_html").length > 0) {
                $(".sort-list-img .images_upload_html:last").after(last_div);  // 插入一个 新图片
            } else {
                $(".sort-list-img .images_upload:last").before(last_div);  // 插入一个 新图片
            }
            $(".sort-list-img .images_upload_html:last").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
            $(".sort-list-img .images_upload_html:last").find('img').attr('src',paths[i]);// 修改他的图片路径
            $(".sort-list-img .images_upload_html:last").find('a:eq(1)').attr('onclick',"ClearPicArr2(this,'"+paths[i]+"')").text('');
            $(".sort-list-img .images_upload_html:last").find('input').first().val(paths[i]); // 设置隐藏域 要提交的值
            $(".sort-list-img .images_upload_html:last").find('input').attr('name', 'proimg['+maxId+'][]');
        }            
    }
    /*
     * 上传之后删除组图input     
     * @access   public
     * @val      string  删除的图片input
     */
    function ClearPicArr2(obj,path)
    {
        $(obj).parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片     
    }

</script>
{include file="footer.htm" /}